<?php namespace Home\Controller;
use Hdphp\Controller\Controller;
use Common\Model\Goods;
use Common\Model\Detail;
use Common\Model\GoodsList;
class DetailsController extends Controller{
	public function index(){
		$goodsModel=new Goods;
		$gid=Q('get.gid');
//		拿到商品数据
		$goodsData=$goodsModel->where("gid={$gid}")->find();
//		拿到商品详情
		$goodsDetail=new Detail;
		$goodsDetails=$goodsDetail->where("goods_gid={$gid}")->find();
		
//		获得货品列表
		$goodsListModel=new GoodsList;
		$goodsListData=$goodsListModel->where("goods_gid={$gid}")->get();
		foreach($goodsListData as $v){
			$combine[]=$v['combine'];
		}
		
			p($combine);
		
		View::with('goodsDetails',$goodsDetails);
		View::with('goodsData',$goodsData);
		View::make();
	}
	
}
